/**
 * @author SHIXINGXING
 */

/* 新增二级科目*/
function add(subjectID){
    window.self.location="subject.do?method=addNextSubject&subjectID=" + subjectID;
}
/* 删除二级科目*/
function del(subjectID){
    var flag = false;
    for (var i = 0; i < document.getElementsByName("ids").length; i++) {
        if (document.getElementsByName("ids")[i].checked) {
            flag = true;
        }
    }
    if (!flag) {
        alert("请选择需要删除的二级科目！");
        return;
    }
    if (window.confirm("确认删除吗？")) {  
        with (document.getElementById("list")) {       
            method = "post";
            action = "subject.do?method=delNextSubject&subjectID=" + subjectID;
            submit();
        }
    }
}
/* 编辑二级科目*/
function edit(subjectID){
    var count = 0;
    var j = 0;
    for (var i = 0; i < document.getElementsByName("ids").length; i++) {
        if (document.getElementsByName("ids")[i].checked) {
            j = i;
            count++;
        }
    }
    if (count == 0) {
        alert("请选择需要修改的二级科目！");
        return;
    }
    if (count > 1) {
        alert("一次只能修改一个二级科目！");
        return;
    }
    if (count == 1) {
        window.self.location = "subject.do?method=editNextSubject&subjectID=" +
        document.getElementsByName("ids")[j].value + "&subjectParentID=" + subjectParentID;
    }
}
